package com.uca.authority.conf.utils;

import com.uca.authority.conf.domain.UcaConf;


/**
 * 拼接url相关工具类
 * @author 张增强
 * @date 2021-04-13
 * @version 1.0
 */
public class UrlUtils {

    /**
     * 拼接url参数
     * @param ucaConf
     * @param url_buffer
     * @return
     */
    public static StringBuffer parseUrlParams(UcaConf ucaConf, StringBuffer url_buffer){
        String[] split = ucaConf.getCheckType().split(",");
        for (String s: split) {
            if ("1".equals(s)){
                url_buffer.append("user=${user}");
                url_buffer.append("&");
            }
            if ("2".equals(s)){
                url_buffer.append("token=${token}");
                url_buffer.append("&");
            }
            if ("3".equals(s)){
                url_buffer.append("corp=${corp}");
                url_buffer.append("&");
            }
            if ("4".equals(s)){
                url_buffer.append("sys=");
                url_buffer.append(ucaConf.getSourceFlag());
                url_buffer.append("&");
            }
        }
        return url_buffer;
    }

}
